<template>
	<view class="content">
		<view class="top_area">
			<view class="user_info_area">
				<view class="user_img" >
					<image :src="userImg" mode="" v-if='userImg'></image>
					<image src="http://hgry.oss-cn-hangzhou.aliyuncs.com/imgs/user_img%402x.png" mode="" v-if='!userImg'></image>
				</view>
				<view class="user_img">
					<view class="username">{{nickName}}</view>
				</view>
				
			</view>
			<view class="income_area">
				<view class="income_box">
					<view class="income_box_item">
						<view class="income_box_item_num">
							{{numFilter(profit)}}
						</view>
						<view class="income_box_item_name">
							总收益(元)
						</view>
					</view>
					<view class="income_box_item">
						<view class="income_box_item_num">
							{{numFilter(todayProfit)}}
						</view>
						<view class="income_box_item_name">
							今日收益
						</view>
					</view>
					<view class="income_box_item">
						<view class="income_box_item_num">
							{{numFilter(weekProfit)}}
						</view>
						<view class="income_box_item_name">
							周收益
						</view>
					</view>
				</view>
			</view>
		</view>
		
		<view class="service_area">
			<view class="service_boxs">
				<view class="service_boxs_item" @tap="goOrderList()">
					<view class="text">我的订单</view>
					<image class="right_icon" src="../../../static/images/more@2x.png"></image>
				</view>
				<view class="service_boxs_item" @tap="goAssembleList()">
					<view class="text">我的拼团</view>
					<image class="right_icon" src="../../../static/images/more@2x.png"></image>
				</view>
				<view class="service_boxs_item" @tap="goBudgetDetails()">
					<view class="text">我的账单</view>
					<image class="right_icon" src="../../../static/images/more@2x.png"></image>
				</view>
				
				
			</view>
			
		</view>
	</view>
	
</template>

<script>
	import md5 from '../../../common/md5.js'
	import http from '../../../common/http.js'
	import common from '../../../common/common.js'
	import config from '../../../common/config.js'
	export default {
		components: {},
		data() {
			return {
                profitData:[],
				todayProfit:"",
				yesterdayProfit:"",
				weekProfit:"",
				profit:"",
				userImg:"",//头像
				nickName:"",//昵称
			}
		},
		onLoad() {
             this.getProfitData();//初始化获取总收益
			 this.userImg =uni.getStorageSync("userImg");
			 this.nickName =uni.getStorageSync("userName");
			 
			 /* uni.getStorageSync('userPhone');
			 uni.getStorageSync('userName');
			 uni.getStorageSync('userToken');
			 uni.getStorageSync('userSex');
			 uni.getStorageSync('userImg'); */
		},
		methods: {
			  numFilter (value) {//收益数计算
					let realVal = ''
					if (value) {
					  // 截取当前数据到小数点后两位
					  realVal = parseFloat(value)/100;
					  realVal = realVal.toFixed(2);
					} else {
					  realVal = '0'
					}
					return realVal
			  },
			goOrderList(){
				uni.navigateTo({
					url: '../orderList/orderList'
				})
			},
			goAssembleList(){
				uni.navigateTo({
					url: '../assembleList/assembleList'
				})
			},
			goBudgetDetails(){
				uni.navigateTo({
					url: '../budgetDetails/budgetDetails'
				})
			},
			getProfitData(){
				var that =this;
				let params = {
						appid:common.appid,
						api_version:common.apiversion,
						timestamp:common.timesTamp,
						token:uni.getStorageSync("userToken"),
					};
				   let signStr = common.sign(params);
				   params.sign = signStr;
					 uni.request({
						 url:config.assembleUrl+'group/profit/overview', 
						 method:"POST",
						 header:{
							 'content-type':'application/x-www-form-urlencoded',
							  },
						data: params,
						 success: function (res) {
							 
						 }
					 });
			}
		},
		mounted(){
			this.getProfitData();
		},
	}
</script>

<style>
	page {
		background: rgba(245, 245, 245, 1);
	}

	.content {
		width: 100%;
		height: 100%;
		padding-bottom: 10px;
	}

	.top_area {
		width: 100%;
		height: 400upx;
		background-image: url('http://hgry.oss-cn-hangzhou.aliyuncs.com/imgs/mine_back%402x.png');
		background-repeat: no-repeat;
		background-size: cover;
		background-color: red;
		position: fixed;
	}

	.user_info_area {
		margin:15% 0 0 5%; 
		width: 95%;
	}

	.user_img {
		width: 100%;
		text-align: center;
		margin-top:0px;
	}

	.user_img image {
		width: 70px;
		height: 70px;
		border-radius: 20px;
	}

	.user_detail {
		width: 75%;
		height: 100%;
		padding-left: 10px;
	}

	.nickname {
		width: 100%;
		height: 26px;
		font-size: 16px;
		font-family: PingFangSC-Medium, PingFangSC;
		font-weight: 500;
		color: rgba(255, 255, 255, 1);
		line-height: 20px;
	}

	.vip {
		width: 100%;
		height: 26px;
		font-size: 11px;
		font-family: PingFangSC-Regular, PingFangSC;
		font-weight: 400;
		color: rgba(255, 255, 255, 1);
		line-height: 15px;
	}

	.inviteid {
		width: 100%;
		height: 26px;
		font-size: 11px;
		font-family: PingFangSC-Regular, PingFangSC;
		font-weight: 400;
		color: rgba(255, 255, 255, 1);
		line-height: 15px;
		display: flex;
	}

	.inviteid view {
		margin-left: 8px;
		width: 26px;
		height: 14px;
		font-size: 9px;
		font-family: PingFangSC-Regular, PingFangSC;
		font-weight: 400;
		color: rgba(255, 255, 255, 1);
		border: 1px solid #FFFFFF;
		line-height: 12px;
		text-align: center;
	}

	.signin_area {
		width: 45.5px;
		height: 25px;
		background: linear-gradient(90deg, rgba(255, 181, 36, 1) 0%, rgba(255, 116, 27, 1) 100%);
		border-radius: 100px 0px 0px 100px;
		font-size: 12px;
		font-family: PingFangSC-Regular, PingFangSC;
		font-weight: 400;
		color: rgba(255, 255, 255, 1);
		line-height: 25px;
		text-align: center;
		margin-top: 20px;
	}

	.income_area {
		width: 94%;
		margin: 0 auto;
		position: absolute;
		left:3%;
		bottom: -40px;
		border-radius: 10px;
		box-shadow: 0px 8px 20px 0px rgba(153, 153, 153, 0.2);
		background-color: #FFFFFF;
	}

	.myorder_area {
		width: 94.6%;
		height: 120px;
		margin: 0 auto;
		margin-top: 40px;
		border-radius: 10px;
		box-shadow: 0px 8px 20px 0px rgba(153, 153, 153, 0.2);
		background-color: #FFFFFF;
	}

	.income_box {
		width: 100%;
		height: 70px;
		display: flex;
	}

	.income_box_item {
		width: 33.3%;
		height: 70px;
		text-align: center;
	}

	.income_box_item_num {
		width: 100%;
		height: 40px;
		font-size: 18px;
		font-family: PingFangSC-Medium, PingFangSC;
		font-weight: 500;
		color: rgba(51, 51, 51, 1);
		line-height: 60px;
		font-weight: bold;
	}

	.income_box_item_name {
		width: 100%;
		height: 20px;
		font-size: 12px;
		font-family: PingFangSC-Regular, PingFangSC;
		font-weight: 400;
		color: rgba(102, 102, 102, 1);
		line-height: 20px;
		text-align: center;
	}

	.income_do {
		width: 94.6%;
		height: 40px;
		margin: 0 auto;
		border-top: 1px solid #E5E5E5;
		text-align: right;
	}

	.income_do view {
		margin-left: 8px;
		margin-top: 10px;
		width: 55px;
		height: 26px;
		text-align: center;
		line-height: 26px;
		border-radius: 26px;
		border: 1px solid rgba(254, 67, 56, 1);
		font-size: 14px;
		font-family: PingFangSC-Regular, PingFangSC;
		font-weight: 400;
		color: rgba(254, 67, 56, 1);
		float: right;
	}

	.myorder_top {
		width: 100%;
		height: 28px;
		display: flex;
		padding-top: 20px;
	}

	.myorder_tittle {
		padding-left: 5%;
		width: 45%;
		font-size: 16px;
		font-family: PingFangSC-Medium, PingFangSC;
		font-weight: 500;
		color: rgba(51, 51, 51, 1);
		line-height: 16px;
	}

	.myorder_selectAll {
		width: 45%;
		font-size: 11px;
		font-family: PingFangSC-Regular, PingFangSC;
		font-weight: 400;
		color: rgba(51, 51, 51, 1);
		line-height: 15px;
		text-align: right;
	}

	.myorder_boxs {
		width: 100%;
		height: 73px;
		display: flex;
	}

	.myorder_box_item {
		width: 25%;
		height: 35px;
		text-align: center;
	}

	.myorder_box_item image {
		width: 35px;
		height: 35px;
	}

	.myorder_box_item view {
		width: 100%;
		font-size: 11px;
		font-family: PingFangSC-Regular, PingFangSC;
		font-weight: 400;
		color: rgba(102, 102, 102, 1);
		line-height: 12px;
	}

	.service_area {
		width: 94.6%;
		margin: 0 auto;
		margin-top: 270px;
		border-radius: 10px;
		box-shadow: 0px 8px 20px 0px rgba(153, 153, 153, 0.2);
		background-color: #FFFFFF;
	}

	.service_top {
		width: 100%;
		height: 28px;
		display: flex;
		padding-top: 20px;
	}

	.service_tittle {
		padding-left: 5%;
		width: 45%;
		font-size: 16px;
		font-family: PingFangSC-Medium, PingFangSC;
		font-weight: 500;
		color: rgba(51, 51, 51, 1);
		line-height: 16px;
	}

	.service_boxs {
		display: flex;
		flex-wrap: wrap;
		flex-direction: row;
	}

	.service_boxs_item {
		display: flex;
		border-bottom: 1px solid #F0F0F0;
		width: 94%;
		margin: 0 3%;
	}

	.service_boxs_item image {
		width: 30px;
		height: 30px;
	}

	.service_boxs_item view {
		width: 100%;
		text-align: center;
		height: 22px;
		font-size: 11px;
		font-family: PingFangSC-Regular, PingFangSC;
		font-weight: 400;
		color: rgba(51, 51, 51, 1);
		line-height: 22px;
	}

	.tel {
		width: 130px;
		height: 12px;
		margin: 0 auto;
		display: flex;
		margin-top: 10px;
	}

	.tel_text {
		width: 60px;
		font-size: 12px;
		font-family: PingFangSC-Regular, PingFangSC;
		font-weight: 400;
		color: rgba(51, 51, 51, 1);
		line-height: 12px;
		text-align: right;
	}

	.tel_num {
		width: 70px;
		font-size: 12px;
		font-family: PingFangSC-Regular, PingFangSC;
		font-weight: 400;
		color: #3E86FF;
		line-height: 14px;
	}

	.online_time {
		margin-top: 10px;
		width: 100%;
		text-align: center;
		font-size: 10px;
		font-family: PingFangSC-Regular, PingFangSC;
		font-weight: 400;
		color: rgba(153, 153, 153, 1);
		line-height: 10px;
	}
	.username{
		color: #ffffff;
		font-weight: bold;
		letter-spacing: 0.2em;
	}
	.service_boxs_item .text{
		flex: 4;
		text-align: left;
		line-height: 50px;
		height: 50px;
		font-size: 1em;
	}
	.service_boxs_item .right{
		flex: 1;
		line-height: 50px;
		height: 50px;
		font-size: 1rem;
	}
	.service_boxs_item .right_icon{
		width: 20px;
		height: 20px;
		margin: 3%;
		margin-right: 0;
	}
</style>
